//
// GameEnv class
//

#ifndef CGAMEENV_H
#define CGAMEENV_H

#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#include <SDL/SDL_image.h>

#include "glee/glee.h" // We will need this for extensions later in development.
#include <gl/gl.h>
#include <gl/glu.h>

#include <stdio.h> // Standard input/output is needed for printf and file reading. Check http://en.wikipedia.org/wiki/Stdio.h
#include <math.h>
#include <string>
#include <iostream>
#include <sstream> // Used by Utility to convert nums to strings. Can also set precision. Like .2f

#include "C2DHelpers.h"
#include "CVectorText.h"
#include "CUtility.h"
#include "CGLMatrix.h"
#include "LoadTexture.h"
#include "CTexture.h"
#include "C3DObject.h"
#include "CVector3.h"


/*****************
 * Provides framework for
 * the game world.
 *****************/
class CGameEnv
{
    private:

    protected:
    // OpenGL surface
    SDL_Surface* drawContext;

    FILE * ctt;

    // Input
    Uint8 *keystate;
    int mouseX, mouseY;
    bool bMouseLeft, bMouseRight;

    int resolutionX, resolutionY;
    SDL_Event event;
    bool done;

    void initializeAll();
    void initializeGL();
    void initializeSDL();
    void handleEvents();
    void cleanUp();

    virtual void resize(int width, int height);
    virtual void tick();
    virtual void drawFrame();

    public:
    CGameEnv();
    //~CGameEnv();
    void startGame();

    // returns true if the mousebuttion (1 or 2) is down.
    bool mouseDown(int button);

};
#endif
